package com.qdxwx.data.mapper.member;

import com.qdxwx.common.page.PageRequest;
import com.qdxwx.models.member.MemberRecord;
import com.qdxwx.models.member.MemberRecordVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * MemberRecord接口
 * Qdx NetSchool Platform
 * @author qdxwx
 * @updateTime 2022/5/25
 * @description
 */
@Repository
public interface MemberRecordMapper {

	/**
	 * 添加MemberRecord
	 * 
	 * @param memberRecord
	 *            要添加的MemberRecord
	 * @return id
	 */
	Long createMemberRecord(MemberRecord memberRecord);

	/**
	 * 修改MemberRecord
	 *
	 * @param memberRecord
	 *            要修改的MemberRecord
	 */
	void updateMemberRecord(MemberRecord memberRecord);

	/**
	 * 根据id获取单个MemberRecord对象
	 *
	 * @param id
	 *            要查询的id
	 * @return MemberRecord
	 */
	MemberRecord selectMemberRecordById(Long id);

	/**
	 * 根据用户id、会员类型查询MemberRecord对象(不论是否过期)
	 *
	 * @param userId
	 * @param typeId
	 * @return
	 */
	MemberRecord selectLastMemberRecordByUserId(@Param("userId") Long userId, @Param("typeId") Integer typeId);

	/**
	 * 根据用户id、会员类型查询MemberRecord对象(有效期之内)
	 * @param userId
	 * @param typeId
	 * @return
	 */
	MemberRecord selectValidMemberRecordByUserId(@Param("userId") Long userId, @Param("typeId") Integer typeId);

	/**
	 * 会员关闭 更新状态
	 * 
	 * @param memberRecord
	 */
	void updateMemberStatus(MemberRecord memberRecord);

    List<MemberRecordVO> selectMemberRecordVOList(@Param("e") MemberRecord memberRecord, @Param("page")PageRequest page);

	List<MemberRecord> selectMemberRecordList(@Param("e")MemberRecord memberRecord, @Param("page")PageRequest page);

	int selectMemberRecordCount(@Param("e")MemberRecord memberRecord);

	int deleteByIds(String[] ids);

    int deleteById(long id);

	int updateCombine(long userId1, long userId2);
}